

<?php 



class message{



	function getListByUserId($parm){

		$msg = null;
		$result = DB::select('*')->from('sysmessage')->where("userId","=",$parm['userId'])->limit(10)->offset(($parm['page']-1)*10)->execute()->as_array();
		$sum = DB::select('count(1) as count')->from('sysmessage')->where("userId","=",$parm['userId'])->execute()->as_array();
		$msg['result'] =$result;
		$msg['count'] = $sum[0]['count'];
		return $msg;
	}
	function deleteBatch($parm){

		$ids = explode(',', $parm['id']);

		foreach ($ids as $key => $value) {
			DB::delete('sysmessage')->where('id','=',$value)->execute();
		}
	}

	function detail($parm){
		$result = DB::select('*')->from('sysmessage')->where("id","=",$parm['id'])->execute()->as_array();
		return $result;
		
	}
}